import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    redirect: '/lifeCycle',
    component: Home,
    children: [
      {
        path: '/lifeCycle',
        name: 'LifeCycle',
        component: () => import('../components/LifeCycle.vue')
      },
      {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/About.vue')
      },
      {
        path: '/store',
        name: 'Store',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import(/* webpackChunkName: "store" */ '../components/Store.vue')
      },
      {
        path: '/teleport',
        name: 'Teleport',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import(/* webpackChunkName: "store" */ '../components/Teleport.vue')
      },
      {
        path: '/suspense',
        name: 'Suspense',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
          import(
            /* webpackChunkName: "store" */ '../components/Suspense/index.vue'
          )
      },
      {
        path: '/provideInject',
        name: 'ProvideInject',
        component: () => import('../components/ProvideInject/provide.vue')
      }
    ]
  },

  {
    path: '/drySister',
    name: 'DrySister',
    component: () => import('../views/DrySister.vue')
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
